package com.learn.micro_mall.repository.convertor.goods;

import com.learn.micro_mall.dao.skuParam.model.SkuParam;
import com.learn.micro_mall.domain.entity.goods.GoodsSkuParamEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper
public interface SkuParamConvert {

    /**
     * 获取该类自动生成的实现类的实例
     * 接口中的属性都是 public static final 的 方法都是public abstract的
     */
    SkuParamConvert INSTANCES = Mappers.getMapper(SkuParamConvert.class);

    @Mappings({
            @Mapping(source = "skuParamKey", target = "goodsSkuParamId.skuParamKey")
    })
    GoodsSkuParamEntity toSkuParamEntity(SkuParam brandEntity);

    @Mappings({
            @Mapping(source = "goodsSkuParamId.skuParamKey", target = "skuParamKey")
    })
    SkuParam toSkuParam(GoodsSkuParamEntity brandEntity);

}
